package com.music.service.Impl;

import com.music.mapper.LocalSongMapper;
import com.music.service.LocalSongService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional // 启用事务管理
public class LocalSongServiceImpl implements LocalSongService {
    private final LocalSongMapper localSongMapper;

    public LocalSongServiceImpl(LocalSongMapper localSongMapper) {
        this.localSongMapper = localSongMapper;
    }

    @Override
    public int addLocalSong(Map<String, Object> localSong) {
        return localSongMapper.addLocalSong(localSong);
    }

    @Override
    public List<Map<String, Object>> showAllLocalSongs() {
        return localSongMapper.showAllLocalSongs();
    }

    @Override
    public int deleteLocalSong(int localSongId) {
        return localSongMapper.deleteLocalSong(localSongId);
    }

    @Override
    public int addDownloadedSongToLocal(Map<String, Object> localSong) {
        return localSongMapper.addDownloadedSongToLocal(localSong);
    }
}

